<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>登录</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="stylesheet" href="./AmazeUI-2.4.2/assets/css/amazeui.css"/>
    <link href="./css/dlstyle.css" rel="stylesheet" type="text/css">
    <script src="./AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
    <script src="./AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>

    <!-- 导入vue和axios的核心js -->
    <script src="./plugins/vue/dist/vue.js"></script>
    <script src="./plugins/axios/dist/axios.js"></script>
    <script src="./js/axios.common.js"></script>
    <style type="text/css">
        .am-tab-panel {
            margin-top: -20px;
        }

        .validateMsg {
            font-size: 12px;
            color: #ff0000;
        }

        #dyMobileButton:disabled {
            cursor: no-drop;
        }
    </style>
</head>

<body>
<div id="app">
    <div class="login-boxtitle">
        <a href="home.html"><img alt="logo" src="./images/logobig.png"/></a>
    </div>

    <div class="login-banner">
        <div class="login-main">
            <div class="login-banner-bg"><span></span><img src="./images/big.jpg"/></div>
            <div class="login-box">
                <div class="am-tabs" id="doc-my-tabs">
                    <ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
                        <li class="am-active"><a href="">账号密码登录</a></li>
                        <li><a href="">短信验证码登录</a></li>
                    </ul>
                    <div class="am-tabs-bd">
                        <!-- 账号密码登录 -->
                        <div class="am-tab-panel am-active">
                            <form :model="accountLoginForm">
                                <div class="user-name">
                                    <label for="user"><i class="am-icon-user"></i></label>
                                    <input type="text" v-model="accountLoginForm.account" id="user"
                                           placeholder="邮箱/手机/用户名">
                                </div>
                                <div class="user-pass">
                                    <label for="password"><i class="am-icon-lock"></i></label>
                                    <input type="password" v-model="accountLoginForm.password" id="password"
                                           placeholder="请输入密码">
                                </div>
                            </form>
                            <div class="login-links">
                                <label for="remember-me"><input id="remember-me"
                                                                @click="accountLoginForm.rememberMe = !accountLoginForm.rememberMe"
                                                                type="checkbox">记住密码</label>
                                <a href="register.html" class="am-fr">注册</a>
                                <a href="#" class="am-fr">忘记密码&nbsp;&nbsp;</a>
                                <br/>
                            </div>
                            <div class="am-cf">
                                <input type="submit" @click="submitAccountLoginForm" value="登 录"
                                       class="am-btn am-btn-primary am-btn-sm">
                            </div>
                        </div>
                        <!-- 短信验证码登录 -->
                        <div class="am-tab-panel">
                            <form method="post" :model="phoneLoginForm">
                                <div class="user-phone" id="phoneDiv">
                                    <label for="phone"><i class="am-icon-mobile-phone am-icon-md"></i></label>
                                    <input type="tel" v-model="phoneLoginForm.phone" @blur="validatePhone" id="phone"
                                           placeholder="请输入手机号">
                                    <span class="validateMsg">{{phoneValidateMsg}}</span>
                                </div>
                                <div class="verification" id="verifyCodeDiv">
                                    <label for="code"><i class="am-icon-code-fork"></i></label>
                                    <input type="tel" v-model="phoneLoginForm.verifyCode" @blur="validateVerifyCode"
                                           id="code" placeholder="请输入验证码">
                                    <button type="button" class="btn" @click="sendMobileCode();" :disabled="btnDisabled"
                                            id="dyMobileButton">
                                        {{btnText}}
                                    </button>
                                    <br/>
                                    <span class="validateMsg">{{verifyCodeValidateMsg}}</span>
                                </div>
                            </form>
                            <div class="am-cf">
                                <input type="submit" @click="submitPhoneLoginForm" value="登录"
                                       class="am-btn am-btn-primary am-btn-sm am-fl">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="partner">
                    <h3>合作账号</h3>
                    <div class="am-btn-group">
                        <li><a href="#"><i class="am-icon-qq am-icon-sm"></i><span>QQ登录</span></a></li>
                        <li><a href="#"><i class="am-icon-weibo am-icon-sm"></i><span>微博登录</span> </a></li>
                        <li><a href="javascript:void(0)" @click="wechatLogin"><i
                                class="am-icon-weixin am-icon-sm"></i><span>微信登录</span> </a></li>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="footer ">
        <div class="footer-hd ">
            <p>
                <a href="# ">恒望科技</a>
                <b>|</b>
                <a href="# ">商城首页</a>
                <b>|</b>
                <a href="# ">支付宝</a>
                <b>|</b>
                <a href="# ">物流</a>
            </p>
        </div>
        <div class="footer-bd ">
            <p>
                <a href="# ">关于恒望</a>
                <a href="# ">合作伙伴</a>
                <a href="# ">联系我们</a>
                <a href="# ">网站地图</a>
                <em>© 2015-2025 Hengwang.com 版权所有. 更多模板 <a href="http://www.cssmoban.com/" target="_blank"
                                                           title="模板之家">模板之家</a> - Collect from <a
                        href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></em>
            </p>
        </div>
    </div>
</div>
<script type="text/javascript">
    //jQuery的入口函数：页面加载完毕后执行
    $(function () {
        $('#doc-my-tabs').tabs();   //启用选项卡组件的功能效果
    })

    new Vue({
        el: "#app",
        data: {
            phoneLoginForm: {    //短信验证码登录的表单
                phone: '',
                verifyCode: ''
            },
            phoneValidateMsg: '',
            verifyCodeValidateMsg: '',
            btnText: '获取',
            btnDisabled: false,
            appid: 'wxd853562a0548a7d0',       //微信登录的APPID
            wechatLoginUrl: 'https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect',
            //重定向地址 必须是创建网站应用时设置的授权回调域名
            redirect_uri: 'http://bugtracker.itsource.cn/wechatLogin.html',
            accountLoginForm: {  //账号密码登录的表单
                account: '',
                password: '',
                rememberMe: false,
                type: 1     //1表示前台  2表示后台
            }
        },
        methods: {
            validatePhone() {
            },
            validateVerifyCode() {
            },
            //点击获取短信验证码
            sendMobileCode() {
            },
            //提交短信验证码登录的表单
            submitPhoneLoginForm() {
            },
            //提交账号密码登录的表单
            submitAccountLoginForm() {
                this.$http.post("/lrc/accountLogin", this.accountLoginForm).then(res => {
                    console.debug(res)
                    let {success, msg, data} = res.data
                    if (success) {
                        localStorage.setItem("userToken", data.userToken);
                        localStorage.setItem("loginUser", data.loginUser);
                        location.href = "/index.html"
                    } else {
                        alert(msg)
                    }
                })
            },
            //微信登录
            wechatLogin() {
                alert(222)
                //替换
                this.wechatLoginUrl = this.wechatLoginUrl
                    .replace("APPID", this.appid)
                    .replace("REDIRECT_URI", this.redirect_uri)
                //发送GET请求
                location.href = this.wechatLoginUrl
            }
        },

        mounted() {


        }
    })
</script>
</body>

</html>